<template>
	 <page-meta :root-font-size="`${fontSize}px`"></page-meta>
	<view style="padding: 40rpx;font-size:28rpx;line-height: 48rpx;">
		<view style="margin-bottom: 60rpx;color: #565656;">
			<view class="party-main-title">
				解决问题进度
			</view>
			<view style="padding: 10rpx;">
				<view class="chengxiaopingjia-sub-title" style="color: #cddc39;">简单问题</view>
				<view style="display: flex;justify-content: space-between;">
					<view> <label class="chengxiaopingjia-status">已完成：</label> <label
							class="chengxiaopingjia-number">{{easy.completed}}</label>件（{{ easy.total > 0 ? ((easy.completed / easy.total) * 100).toFixed(1) : 0 }}%）
					</view>
					<view><label class="chengxiaopingjia-status">处理中：</label> <label class="chengxiaopingjia-number"
							style="color:#FF971C">{{easy.pending}}</label> 件</view>
				</view>

			</view>
			<view style="padding: 10rpx;">
				<view class="chengxiaopingjia-sub-title" style="color: orange;">复杂问题</view>
				<view style="display: flex;justify-content: space-between;">
					<view><label class="chengxiaopingjia-status">已完成：</label><label
							class="chengxiaopingjia-number">{{complex.completed}}</label>件（{{ complex.total > 0 ? (( complex.completed / complex.total) * 100).toFixed(1) : 0 }}%）
					</view>
					<view><label class="chengxiaopingjia-status">处理中：</label><label class="chengxiaopingjia-number"
							style="color:#FF971C">{{complex.pending}}</label>件</view>
				</view>
			</view>
			<view style="padding: 10rpx;">
				<view class="chengxiaopingjia-sub-title" style="color: red;">疑难问题</view>
				<view style="display: flex;justify-content: space-between;">
					<view><label class="chengxiaopingjia-status">已完成：</label><label
							class="chengxiaopingjia-number">{{difficult.completed}}</label>件（{{ difficult.total > 0 ? ((difficult.completed / difficult.total) * 100).toFixed(1) : 0 }}%）
					</view>
					<view><label class="chengxiaopingjia-status">处理中：</label><label class="chengxiaopingjia-number"
							style="color:#FF971C">{{difficult.pending}}</label>件</view>
				</view>
			</view>
		</view>

		<view style="font-weight: bold;color: #333333;">
			<view class="party-main-title">
				高频问题分析
			</view>
			<view style="padding: 10rpx;">
				<view class="chengxiaopingjia-sub-title" style="color: #cddc39;">简单问题</view>
				<view style="padding: 10rpx;" v-for="item in jiandanwenti" :key="item.name">
					{{item.name}}：{{item.value}}件
				</view>
			</view>
			<view style="padding: 10rpx;">
				<view class="chengxiaopingjia-sub-title" style="color: orange;">复杂问题</view>
				<view style="padding: 10rpx;" v-for="item in fuzawenti" :key="item.name">{{item.name}}：{{item.value}}件
				</view>
			</view>
			<view style="padding: 10rpx;">
				<view class="chengxiaopingjia-sub-title" style="color: red;">疑难问题</view>
				<view style="padding: 10rpx;" v-for="item in yinanwenti" :key="item.name">{{item.name}}：{{item.value}}件
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import { mapState } from 'vuex'
	export default {
		computed: {
			...mapState(['fontSize'])
		},
		data() {
			return {
				easy: {},
				complex: {},
				difficult: {},
				yinanwenti: [],
				fuzawenti: [],
				jiandanwenti: []
			}
		},
		mounted() {
			if (uni.getStorageSync('projId') == 159) {
				 this.easy = {
      total: 76+53+31,
             completed: 76+53+31-2,
             pending: 2,
      };
      this.complex = {
         total: 19+1+1,
               completed: 19+1+1,
               pending: 0,
      };
      this.difficult = {
        total: 2,
               completed: 2,
               pending: 0,
      };


				this.yinanwenti = [{
					name: "保洁清理",
					value: 2
				}];
				this.fuzawenti = [{
						name: "保洁清理",
						value: 10+1
					},
					{
						name: "故障报修",
						value: 6
					},
				];
				this.jiandanwenti = [{
						name: "故障报修",
						value: 55+24+15
					},
					{
						name: "保洁清理",
						value: 16+10+8 
					},
					{
						name: "消防安全",
						value: 3+10+5 
					},
				];
			}
			if (uni.getStorageSync('projId') == 208) {
			 this.easy = {
			        total: 354+209+233,
					completed: 354+209+219,
					pending: 14,
			      };
			      this.complex = {
			        total: 47+7+3,
					completed: 47+7+3,
					pending: 0,
			      };
			      this.difficult = {
			        total: 4+2+2,
			        completed: 4+2+2,
			        pending: 0,
			      };
				  
				this.yinanwenti = [{
					name: "故障报修",
					value: 2+3
				}];
				this.fuzawenti = [{
						name: "保洁清理",
						value: 30+5+1
					},
					{
						name: "消防安全",
						value: 12+2+1
					},
				];
				this.jiandanwenti = [{
						name: "保洁清理",
						value: 157+104+100
					},
					{
						name: "故障报修",
						value: 128+80+50
					},
					// {
					// 	name: "其他",
					// 	value: 29
					// },
				];
			}
		},
		methods: {

		}
	}
</script>

<style scoped>
	.party-main-title {
		font-size: 32rpx;
		color: #333333;
		font-family: Source Han Sans CN;
		font-weight: bold;
		display: flex;
		align-items: center;

	}

	.party-main-title::before {
		content: "";
		display: inline-block;
		width: 18rpx;
		height: 30rpx;
		background: #4874FF;
		border-radius: 10rpx;
		margin-right: 16rpx;
	}

	.chengxiaopingjia-sub-title {
		font-size: 30rpx;
		padding: 10rpx 0;
		font-weight: bold;
	}

	.chengxiaopingjia-status {
		font-weight: bold;
		font-size: 30rpx;
		color: #565656;
	}

	.chengxiaopingjia-number {
		color: #3D98FF;
		font-weight: bold;
		font-size: 40rpx;
		margin-right: 10rpx;
	}
</style>
